package com.ibiaoke.boss.controller;

import com.ibiaoke.system.service.FloorItemService;
import com.ibiaoke.common.response.Res;
import com.ibiaoke.system.entity.FloorItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2017/6/16.
 */
@Controller
public class FloorItemController {
    @Autowired
    private FloorItemService floorItemService;

    /**
     * 添加floorItem
     * @param floorItem
     * @return
     */
    @ResponseBody
    @RequestMapping("/saveFloorItem")
    public Res saveFloorItem(FloorItem floorItem){
        floorItemService.saveFloorItem(floorItem);
        return Res.create();
    }

    /**
     * 修改floorItem
     * @param floorItem
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateByFloorItemId")
    public Res updateByFloorItemId(FloorItem floorItem){
        floorItemService.updateByFloorItemId(floorItem);
        return Res.create();
    }

    /**
     * 删除floorItem
     * @param floorItemId
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteByFloorItemId")
    public Res deleteByFloorItemId(Integer floorItemId){
        floorItemService.deleteByFloorItemId(floorItemId);
        return Res.create();
    }

    /**
     * 查询floorItem
     * @return
     */
    @ResponseBody
    @RequestMapping("/listFloorItems")
    public Res listFloorItems(Integer floorId,Integer shopId){
        List<FloorItem> listFloorItems = floorItemService.listFloorItems(floorId,shopId);
        return Res.create().addResponse("listFloorItems", listFloorItems);
    }
}
